home *** CD-ROM | disk | FTP | other *** search
- Path: druid.borland.com!usenet
- From: pete@borland.com (Pete Becker)
- Newsgroups: comp.lang.c++,
- Subject: Re: Fastest Sorting Algorithm?
- Date: 9 Apr 1996 00:41:22 GMT
- Organization: Borland International
- Message-ID: <4kcbni$t2d@druid.borland.com>
- References: <DpAxtI.3w9@undergrad.math.uwaterloo.ca> <4k26jr$1cj@pipe10.nyc.pipeline.com>
- NNTP-Posting-Host: pbecker.borland.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=ISO-8859-1
- X-Newsreader: WinVN 0.99.5
-
- In article <4k26jr$1cj@pipe10.nyc.pipeline.com>, digiulio@nyc.pipeline.com
- says...
- >
- >2) If you are willing to sacrifice space for time, create an array of
- >pointers, which point to the records in the array. Move the pointers in
- >the same manner as the quicksort would move the records, and the pointers
- >would point to the records in sorted order.This would reduce the number of
- >swaps from O(n log n) to n.
-
- Close: it reduces the number of swaps of the underlying data to n. The total
- number of swaps is still O(n log n), but the things being swapped that many
- times are pointers. What this all reduces to is a linear decrease in execution
- time, assuming that the underlying data objects are bigger than pointers.
- -- Pete
-
-